<div class="page cariproperti">
    <form method="GET" action="<?php echo site_url('agen/cari'); ?>">
        <div class="container">
            <legend><h4>Cari Agen</h4></legend>
            <p>Pencarian Berdasarkan Nama Kantor Agen Properti</p>
            <?php
            $bulan = array(
                "01" => "Jan",
                "02" => "Feb",
                "03" => "Mar",
                "04" => "Apr",
                "05" => "Mei",
                "06" => "Jun",
                "07" => "Jul",
                "08" => "Aug",
                "09" => "Sept",
                "10" => "Okt",
                "11" => "Nov",
                "12" => "Des"
            );
            $azRange = range('A', 'Z');
            foreach ($azRange as $letter) {
                echo "<a href='" . site_url('agen/cari/?kategori=1&search=' . strtolower($letter)) . "' class='btn'>$letter</a>";
            }
            echo "<a href='" . site_url('agen/cari') . "' class='btn'>All</a>";
            ?>
            <div class="form_cariagen">
                <div class="row">
                    <input type="text" value="<?php
            echo $this->input->get('search', TRUE);
            ?>" placeholder="Kata kunci: nama agen, kantor agen, spesialisasi pemasaran" name="search" class="span5 katakunci" />
                    <div class="span5">
                        Cari Perkategori :
                        <select name="kategori" value="" class="select-block span3 cariperkategori">
                            <option value="1"
                            <?php if ($this->input->get('kategori') == "1") echo "selected"; ?>
                                    >Nama Kantor Agen</option>
                            <option value="2"
                            <?php if ($this->input->get('kategori') == "2") echo "selected"; ?>
                                    >Nama Agen</option>
                            <option value="3"
                            <?php if ($this->input->get('kategori') == "3") echo "selected"; ?>
                                    >Spesialisasi Pemasaran</option>

                        </select>
                    </div>
                    <input type="submit" class="btn btn-primary btn-small span2 submitcaripropertibaru" value="Cari" />
                </div>
            </div>
            <?php
                    if (count($result) > 0) {?>
            <legend><h4>Daftar Agen</h4></legend>
            <div class="span12 daftar_agen">
                <div class="row header_daftar_agen pull-right">
                    Hasil Pencarian: Menampilkan
                    <?php
                    if (count($result) > 0) {
                        echo ($page - 1) * $nitem + 1;
                    } else {
                        echo ($page - 1) * $nitem;
                    }
                    echo " - ";
                    echo ($page - 1) * $nitem + count($result);
                    ?>
                    dari <?php echo $total; ?> agen |
                    Urutkan Berdasarkan:
                    <select name="urutan" value="" class="select-block span3"
                            onchange="this.form.submit()">
                        <option value="1"
                        <?php if ($this->input->get('urutan') == "1") echo "selected"; ?>
                                >Nama Agen (A-Z)</option>
                        <option value="2"
                        <?php if ($this->input->get('urutan') == "2") echo "selected"; ?>
                                >Nama Agen (Z-A)</option>
                        <option value="3"
                        <?php if ($this->input->get('urutan') == "3") echo "selected"; ?>
                                >Listing Terbanyak</option>
                        <option value="4"
                        <?php if ($this->input->get('urutan') == "4") echo "selected"; ?>
                                >Listing Dilihat Terbanyak</option>
                    </select>
                    Hasil Perhalaman:
                    <select name="nitem" value="" class="select-block span1"
                            onchange="this.form.submit()">
                        <option value="10"
                        <?php if ($this->input->get('nitem') == "10") echo "selected"; ?>
                                >10</option>
                        <option value="20"
                        <?php if ($this->input->get('nitem') == "20") echo "selected"; ?>
                                >20</option>
                        <option value="30"
                        <?php if ($this->input->get('nitem') == "30") echo "selected"; ?>
                                >30</option>
                    </select>
                </div>
                <div class="row">
                    <?php
                        foreach ($result as $value) {
                            ?>
                            <div class="span6 agen row">
                                <p class="palette-paragraph">Bergabung Sejak
                                    <?php
                                    echo substr($value->tgl_bergabung, 8, 2) . " " .
                                    $bulan[substr($value->tgl_bergabung, 5, 2)] . " " .
                                    substr($value->tgl_bergabung, 0, 4);
                                    ?>
                                </p>
                                <div class="span2 fotoagen">
                                    <img src="<?php echo base_url(); ?>assets/img/taufan.jpg" class="img-polaroid">
                                </div>
                                <div class="span3 detilagen">
                                    <h5><?php echo $value->nama_depan . " " . $value->nama_belakang ?></h5>
                                    <p class="palette-paragraph">
                                        Spesialisasi Area: Jaksel <br/>
                                        Spesialisasi Properti: Apartemen <br/>
                                        Listing Aktif: <?php echo $value->count; ?> <br/>
                                        HP: <?php echo $value->no_hp; ?> <br/>

                                        <a href="
                                        <?php echo site_url('agen/detail/' . $value->user_id . '/1'); ?>
                                           ">Lihat Detail</a> | 
                                        <a href="#hubungiAgen" data-toggle="modal">Hubungi Agen</a>

                                    </p>
                                </div>
                                <div class="span1 logoagensi">
                                    <img src="<?php echo base_url(); ?>assets/img/logo.jpg" class="img-polaroid">
                                    <p class="palette-paragraph">
                                        <strong>
                                            <?php echo $value->nama_perusahaan; ?>
                                        </strong><br/>
                                        <?php echo ucwords($value->kota_kab); ?> <br/>
                                        No Arebi: 12345
                                    </p>
                                </div>
                            </div>
                            <?php
                        }
                    } else { ?>
                        <h3>Hasil pencarian tidak ditemukan...</h3>
                    <?php }
                    ?>
                </div>
                <center>
                    <div class="paginasi">
                        <?php echo $this->pagination->create_links(); ?>
                    </div>
                </center>
            </div>
        </div>
    </form>
</div>
<div id="hubungiAgen" class="modal hide fade" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h4 id="myModalLabel">Hubungi Agen</h4>
    </div>
    <form action="" id="input-form" class="form-horizontal">
        <div class="modal-body">
            <!-- <div class="row">
                <div class="span3">Saya ingin dihubungi,karena:</div>
                <select name="status" for="status" class="select-block span4">
                    <option value="0">Saya ingin melihat porperti ini</option>
                    <option value="1">Saya ingin informasi lebih lanjut</option>
                    <option value="2">Saya mempunyai tempat serupa utk dijual/disewa</option>
                </select>
            </div>       
            <div class="control-group">
                  <label class="control-label" for="name">Nama Anda</label>
                  <div class="controls">
                    <input type="text" class="input-xlarge" name="name" id="name">
                  </div>
            </div> -->
            <div class="control-group">
                <label class="control-label" for="dihubungi">Saya ingin dihubungi,karena:</label>
                <div class="controls">
                    <select name="dihubungi" id="dihubungi">
                        <option value="0">Saya ingin melihat properti ini</option>
                        <option value="1">Saya ingin informasi lebih lanjut</option>
                        <option value="2">Saya mempunyai tempat serupa utk dijual/disewa</option>
                    </select>
                </div>           
            </div>       
            <div class="control-group">
                <label class="control-label" for="titel">Titel:</label>
                <div class="controls">
                    <select name="titel" id="titel" class="span3">
                        <option value="0">Bapak</option>
                        <option value="1">Ibu</option>
                        <option value="2">Sdr/i</option>
                    </select>
                </div> 
            </div>
            <div class="control-group">
                  <label class="control-label" for="name">Nama Anda</label>
                  <div class="controls">
                    <input type="text" class="input-xlarge" name="name" id="name">
                  </div>
            </div>
            <div class="control-group">
                  <label class="control-label" for="name">Alamat E-mail</label>
                  <div class="controls">
                    <input type="text" class="input-xlarge" name="email" id="email">
                  </div>
            </div>
            <div class="control-group">
                  <label class="control-label" for="tel">No. HP</label>
                  <div class="controls">
                    <input type="tel" class="input-xlarge" name="tel" id="tel">
                  </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="hubungisaya">Hubungi saya via</label>
                <div class="controls">
                    <select name="hubungisaya" id="hubungisaya" class="select-block">
                        <option value="0">Telepon atau E-mail</option>
                        <option value="1">Hanya Telepon</option>
                        <option value="2">Hanya E-mail</option>
                    </select>
                </div> 
            </div>
            <div class="control-group">
                <label class="control-label" for="hubungisaya">Hubungi saya</label>
                <div class="controls">
                    <select name="hubungisaya" id="hubungisaya" class="select-block">
                        <option value="0">Kapan Saja</option>
                        <option value="1">Pagi Hari</option>
                        <option value="2">Sore Hari</option>
                        <option value="3">Malam Hari</option>
                        <option value="4">Akhir Minggu</option>
                    </select>
                </div> 
            </div>
            <label class="checkbox" for="checkbox_berlangganan">
                <input type="checkbox" name="mau_proyek" for="mau_proyek" value="1" id="checkbox_berlangganan" data-toggle="checkbox">
                Berlangganan untuk menerima proyek baru via email
            </label>
            <label class="checkbox" for="checkbox_info_baru">
                <input type="checkbox" name="mau_info" for="mau_info" value="1" id="checkbox_info_baru" data-toggle="checkbox">
                Beritahu saya tentang artyproperty.com informasi terbaru dan tawaran agency
            </label>
            <div class="span4 offset2">
                <input type="submit" name="SUBMIT"  class="btn btn-primary btn-large span3" value="Submit" />
            </div>
        </div>
    </form>
</div>